package cn.tradewin.advisor.commons.propertyconduit;

import java.lang.annotation.Annotation;
import java.util.Map;

import org.apache.tapestry5.PropertyConduit;

public class MapPropertyConduit implements PropertyConduit {
	
	private Object key;
	
	private Class dataType;
	
	public MapPropertyConduit(Object key, Class dataType) {
		this.key = key;
		this.dataType = dataType;
	}

	@Override
	public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object get(Object instance) {
		return ((Map) instance).get(key);
	}

	@Override
	public void set(Object instance, Object value) {
		((Map) instance).put(key, value);
	}

	@Override
	public Class getPropertyType() {
		return dataType;
	}
}
